{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 7.32 NPSH Available Calculation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Given that a pump is located 30 feet above sea level, has a NPSHr of 20' at a flow rate of 400 gpm, and is fed by a tank of 60 deg F water with a surface pressure of 5 psig and a liquid level 25' below the suction of the pump.\n",
    "\n",
    "The head losses in the suction pipeline are 6'.\n",
    "\n",
    "Find the NPSH available and compare it to the NPSHr. A NPSHr margin ratio is required."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "13.887316780096477 foot"
      ],
      "text/latex": [
       "$13.887316780096477\\ \\mathrm{foot}$"
      ],
      "text/plain": [
       "13.887316780096477 <Unit('foot')>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from fluids.units import *\n",
    "rho = 62.364*u.lb/u.ft**3\n",
    "P_tank = 5*u.psi + 1*u.atm\n",
    "Psat = 0.256*u.psi\n",
    "H_tank = 5*u.foot\n",
    "H_pipe = 30*u.foot\n",
    "dH = H_pipe - H_tank\n",
    "\n",
    "head_loss = 6*u.foot\n",
    "\n",
    "NPSHa = ((P_tank-Psat)/rho/u.gravity) - dH - head_loss\n",
    "(NPSHa).to(u.foot)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The NPSHa is beneath the NPSHr. The requested pressure can be calculated as follows:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "26.0 foot"
      ],
      "text/latex": [
       "$26.0\\ \\mathrm{foot}$"
      ],
      "text/plain": [
       "26.0 <Unit('foot')>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "20*u.foot*1.3"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
